{%load static%}
<!DOCTYPE html>
<html lang="zh">
  <head>
    <meta charset="UTF-8" />
    <title>amis demo</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta
      name="viewport"
      content="width=device-width, initial-scale=1, maximum-scale=1"
    />
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <link rel="stylesheet" href="{%static 'amis/sdk.css'%}" />
    <link rel="stylesheet" href="{%static 'amis/helper.css'%}" />
    <link rel="stylesheet" href="{%static 'amis/iconfont.css'%}" />
    <style>
      html,
      body,
      .app-wrapper {
        position: relative;
        width: 100%;
        height: 100%;
        margin: 0;
        padding: 0;
      }
    </style>
  </head>
  <body>
    <div id="root" class="app-wrapper"></div>
    <script src="{%static 'amis/sdk.js'%}"></script>
    <script type="text/javascript">
      (function () {
        let amis = amisRequire('amis/embed');
        let amisJSON =
        {
    "type": "page",
    "title": "智能慢性病监测系统",
    "body": [
      {
        "type": "flex",
        "className": "p-1",
        "items": [
          {
            "type": "container",
            "body": [],
            "size": "xs",
            "style": {
              "position": "static",
              "display": "block",
              "flex": "1 1 auto",
              "flexGrow": 1,
              "flexBasis": "200px"
            },
            "wrapperBody": false,
            "isFixedHeight": false,
            "isFixedWidth": false,
            "id": "u:7db3cc648943"
          },
          {
            "type": "container",
            "body": [
              {
                "id": "u:a42de98c6405",
                "type": "form",
                "title": "",
                "mode": "normal",
                "dsType": "api",
                "feat": "Insert",
                "body": [
                  {
                    "name": "text",
                    "label": "",
                    "type": "input-text",
                    "id": "u:546c3af45155",
                    "required": true,
                    "validateOnChange": false,
                    "value": "",
                    "placeholder": "在此输入你的问题"
                  }
                ],
                "api": {
                  "url": "/api/create_question",
                  "method": "post",
                  "requestAdaptor": "",
                  "adaptor": "",
                  "messages": {},
                  "dataType": "json"
                },
                "actions": [
                  {
                    "type": "button",
                    "label": "重置",
                    "onEvent": {
                      "click": {
                        "actions": [
                          {
                            "actionType": "reset",
                            "componentId": "u:a42de98c6405"
                          }
                        ]
                      }
                    },
                    "level": "default",
                    "id": "u:6644e8e0b16a"
                  },
                  {
                    "type": "button",
                    "label": "发送",
                    "onEvent": {
                      "click": {
                        "actions": [
                          {
                            "actionType": "validate",
                            "ignoreError": false,
                            "componentId": "u:a42de98c6405",
                            "outputVar": "validateResult"
                          },
                          {
                            "actionType": "submit",
                            "componentId": "u:a42de98c6405",
                            "outputVar": "submitResult",
                            "expression": "${event.data.validateResult}",
                            "ignoreError": false
                          },
                          {
                            "ignoreError": false,
                            "actionType": "toast",
                            "args": {
                              "msgType": "info",
                              "position": "top-right",
                              "closeButton": true,
                              "showIcon": true,
                              "msg": "提交成功，即将跳转（${event.data.submitResult.responseData.id}）",
                              "className": "theme-toast-action-scope"
                            },
                            "expression": "${event.data.validateResult}"
                          },
                          {
                            "ignoreError": false,
                            "actionType": "url",
                            "args": {
                              "url": "/chat/detail/${event.data.submitResult.responseData.id}",
                              "blank": false
                            },
                            "expression": "${event.data.validateResult}"
                          }
                        ]
                      }
                    },
                    "level": "primary",
                    "id": "u:337d5c7d12ab"
                  }
                ],
                "resetAfterSubmit": false,
                "className": ""
              }
            ],
            "size": "xs",
            "style": {
              "position": "static",
              "display": "block",
              "flex": "1 1 auto",
              "flexGrow": 1,
              "minWidth": "500px"
            },
            "wrapperBody": false,
            "isFixedHeight": false,
            "isFixedWidth": false,
            "id": "u:74665dd2bf96"
          }
        ],
        "style": {
          "position": "relative",
          "inset": "auto",
          "flexWrap": "nowrap",
          "flexDirection": "column",
          "justifyContent": "space-around",
          "alignItems": "center"
        },
        "id": "u:bd4cee47aa42",
        "isFixedHeight": false,
        "isFixedWidth": false
      }
    ],
    "id": "u:894a36c5eea4",
    "aside": [],
    "asideResizor": true,
    "pullRefresh": {
      "disabled": true
    },
    "themeCss": {
      "baseControlClassName": {
        "padding-and-margin:default": {
          "paddingRight": "var(--sizes-size-9)",
          "paddingLeft": "var(--sizes-size-9)"
        }
      },
      "bodyControlClassName": {
        "padding-and-margin:default": {}
      },
      "titleControlClassName": {
        "font:default": {}
      }
    },
    "regions": [
      "body",
      "header"
    ],
    "data": {},
    "onEvent": {
      "init": {
        "weight": 0,
        "actions": []
      }
    },
    "toolbar": []
  }
          let amisScoped = amis.embed('#root', amisJSON);
      })();
    </script>
  </body>
</html>
